//
//  DetalWorkTableViewCell.m
//  WULIHH
//
//  Created by tang on 16/4/15.
//  Copyright © 2016年 tang. All rights reserved.
//

#import "DetalWorkTableViewCell.h"
#import "Header.h"
#import "AFNetworking.h"
#import "UIImageView+AFNetworking.h"

@interface DetalWorkTableViewCell ()
{
    UIImageView *imageView;
}

@end


@implementation DetalWorkTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self intiUI];
     }
    return self;
}


- (void)intiUI
{
    imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)];
    [imageView setOpaque:YES];
    [self addSubview:imageView];
}


//- (void)setImageUrl:(NSString *)imageUrl
//{
//    [imageView setImageWithURL:[NSURL URLWithString:_imageUrl]];
//    NSLog(@"%@", imageUrl);
//}


- (void)WithHeight:(float)height withWidth:(float)width
{
//    NSLog(@"%d-------%d", width, height);
    
    float k = width/height;
    
    NSLog(@"%f", k);
    
//    if (width >= WithView*2.0)
//    {
//        float k = (WithView*2.0)/width;
//        
//        [self setFrame:CGRectMake(0, 0, WithView, height*k)];
//        [imageView setFrame:self.bounds];
//    }
//    else
//    {
//        float k = (WithView*2.0)/width;
//        [self setFrame:CGRectMake(0, 0, WithView, height*k)];
//        [imageView setFrame:self.bounds];
//    }
//    [self setFrame:CGRectMake(0, 0, 320, 320)];
//    [imageView setFrame:self.bounds];

    
    [imageView setFrame:CGRectMake(0, 0, WithView, WithView/k)];
    [self setFrame:CGRectMake(0, 0, WithView, WithView/k)];
    
    [imageView setImageWithURL:[NSURL URLWithString:_imageUrl]];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
